2023-07-10

Using .desktop Files for Bookmarks

Trying to use bookmarks in browsers to go to commonly visited sites is unfortunately a somewhat terrible experience. So long ago I switched to just doing that externally: Until now I just used a script that opened all these bookmarks in a menu (fuzzel, but any dmenu-like menu works for stuff like this). But as a fan of "do what I mean" features, it always annoyed me how this was yet another separate menu; Press Super+d for applications and Super+o for bookmarks. A bit primitive.

Having custom actions appear in application menus on linux is actually trivial. Just write a custom .desktop file and put it into ~/.local/share/applications/. Each bookmark in its own desktop file would be a bit excessive, but luckily the spec allows to have more than one action per .desktop file.

Here is an example:

[Desktop Entry]
Encoding=UTF-8
Name=bookmark
Comment=online bookmarks
Exec=firefox
Terminal=false
Type=Application
Icon=firefox
Actions=my-site;sourcehut;

[Desktop Action my-site]
Name=My Website
Exec=firefox https://leon_plickat.srht.site

[Desktop Action sourcehut]
Name=sourcehut
Exec=firefox "https://git.sr.ht/"

Now I can open sourcehut inside firefox comfortably from my application menu. No longer do I first have to waste a thought on whether the thing I want to open is an application or a website (and honestly some things are simply both). Nice.

This obviously also works with local files. There are a few books I use often, so I created entries for them as well, this time using xdg-open as the opener.

Having to edit .desktop files to add bookmarks is not very convenient. However the ability to open commonly used webpages and files from my application launcher is worth it for me. I know the launchers of the big desktops do something similar out of the box, but mine doesn't and this is a fine workaround in the meantime. Also I was never particularly happy with how both gnomes launcher and krunner find important files anyway, so at least for me the actual UX of my .desktop file is a tiny bit better, since it gives me direct control over what does appear in the menu and what doesn't.

I do eventually want to have an application launcher menu that allows me to insert non-application entries programmatically, but for now this is enough.

Articles from blogs I read (generated by openring)

Renting is for Suckers

Renting is for Suckers A genie offers you a choice: 50% chance to gain 10 million USD 100% chance to gain 1 million USD Which do you pick? Your answer, of course, depends on how much capital you have. If you are struggling to pay rent, then taking the less risk…

Andrew Kelley, July 24, 2025

Status update, July 2025

Hi! Sway’s patch to add HDR support has finally be merged! It can be enabled via output <name> hdr on, and requires the Vulkan renderer (which can be selected via WLR_RENDERER=vulkan). Still, lots remains to be done to improve tone mapping and compositi…

emersion, July 19, 2025

guile lab notebook: on the move!

Hey, a quick update, then a little story. The big news is that I got Guile wired to a moving garbage collector!Specifically, this is the mostly-moving collector with conservative stack scanning. Most collections will be marked in place. When the collector …

wingolog, July 8, 2025